/*
 * Box drawing routines
 *
 * Copyright (c) 2009-2010 Xaveer Leijtens
 *
 * This file is part of libMask.
 *
 * libMask is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * libMask is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with libMask.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "mask.h"

/* Draw a box with given width, height and linewidth in the current layer
 * with its center at the current pointer position.
 * Current pointer is not moved by this routine.
 */
void box(double width, double height, double linewidth)
{
  push_cp();
  move(-width/2 - linewidth/2, -height/2, 0, 0);
  sw(width + linewidth, linewidth);
  move(-linewidth/2, -linewidth/2, RAD(90), 0);
  sw(height + linewidth, linewidth);
  move(-linewidth/2, -linewidth/2, RAD(90), 0);
  sw(width + linewidth, linewidth);
  move(-linewidth/2, -linewidth/2, RAD(90), 0);
  sw(height + linewidth, linewidth);
  pop_cp();
}
